UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y6msh0kM9nVJKqjaIOsIdliIauCim3qoxkDeuVltVzI=' 
WHERE 
  key_id = '007eca8ceac8ac225941aff4c74dfe0b5e6fdb8aeb111e6307efd1d40f58e82f' 
  AND (
    token = 'y6msh0kM9nVJKqjaIOsIdliIauCim3qoxkDeuVltVzI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019