UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd4EJBI0e+0DPG4ezWqGuNdHl1tWyno/+GfdpWxIiVRc=' 
WHERE 
  key_id = 'c6c69039c08ac51eb91087a8acc075d513165b092eff42ad67030f7becb0181d' 
  AND (
    token = 'd4EJBI0e+0DPG4ezWqGuNdHl1tWyno/+GfdpWxIiVRc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045