UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KOTgDQBy4EADdz139rYnjzyFtQmae5gzdahvaWi92tY=' 
WHERE 
  key_id = 'd8e04501b69a3332cd591f58548d6851383664d8475b1fa4acfe801a6651246a' 
  AND (
    token = 'KOTgDQBy4EADdz139rYnjzyFtQmae5gzdahvaWi92tY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042