UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IjaR5mFodtZsECCp5aQjRBKE3xhZkmRdjNRqMCmizFo=' 
WHERE 
  key_id = '535a412ccca16c2c35f7f7bfb410ebe8df5491ebbde1d71cf2ac3c1df6e646d9' 
  AND (
    token = 'IjaR5mFodtZsECCp5aQjRBKE3xhZkmRdjNRqMCmizFo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026