UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gYaLh6Eb+66UMRE9aOaecmwT2GefooesA02RfeYyVsY=' 
WHERE 
  key_id = '369d1d110aaeefe66d3ef3fcecc52962485248fe008a619229ffca63779c0fae' 
  AND (
    token = 'gYaLh6Eb+66UMRE9aOaecmwT2GefooesA02RfeYyVsY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027