UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JGP/RoEAKtnaXV4OJa5OH5T7650ORdA/NCi6wjzmV00=' 
WHERE 
  key_id = 'ef825ad43e6c01a9428eabb14ff1946cbd527057d79517764083971be474702a' 
  AND (
    token = 'JGP/RoEAKtnaXV4OJa5OH5T7650ORdA/NCi6wjzmV00=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042