UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k3+lrqai/4MKylky0SFJs3l2ZTRRCLIHrimpZHnP4IA=' 
WHERE 
  key_id = '335e73782b04bd10b9e393837e5041b945746a62cca0853920c90f25fa1cbd79' 
  AND (
    token = 'k3+lrqai/4MKylky0SFJs3l2ZTRRCLIHrimpZHnP4IA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037