UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FlHusHEA/d5a51h9WEvvzF51ZuXUoBWOjOnYXIxlB5M=' 
WHERE 
  key_id = 'a8b3560a3b73d58f097249762c6975e7203e995766cf58e377454aab13550579' 
  AND (
    token = 'FlHusHEA/d5a51h9WEvvzF51ZuXUoBWOjOnYXIxlB5M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046