UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X/BsEfhktoBBRMw6xcTJ1u2bdiJdAwFvtcOXAY+ADFI=' 
WHERE 
  key_id = 'b4d6ed68b7f90345b6eddb995d89661d3fc7d5689d7bbde7a56b6220b3036984' 
  AND (
    token = 'X/BsEfhktoBBRMw6xcTJ1u2bdiJdAwFvtcOXAY+ADFI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044