UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SIo1MdL/E9ASAzhOGuyC+wX1HYuByPWbuV0Gbsy1QMo=' 
WHERE 
  key_id = 'c6a84c24765d07f0273474edc93feeda5dee5031b272d81f447217be4ff4d34e' 
  AND (
    token = 'SIo1MdL/E9ASAzhOGuyC+wX1HYuByPWbuV0Gbsy1QMo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037