UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TbPh+hit0ofwI9Oc7+CGQqlYG0AFQTt2OCX+ASSsnp0=' 
WHERE 
  key_id = 'ccde31fa97927e11619838abd916f9bb6cee63f5b530421f087bcd10757c02db' 
  AND (
    token = 'TbPh+hit0ofwI9Oc7+CGQqlYG0AFQTt2OCX+ASSsnp0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037