UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CCeUt7FhqJyBJncw81/faZnJAfUc8Gf+foysZafwEUc=' 
WHERE 
  key_id = '03b5a8f4e2894fadadc529b36e1aa8d1117b77ff9af86ae022d4521ce18e4665' 
  AND (
    token = 'CCeUt7FhqJyBJncw81/faZnJAfUc8Gf+foysZafwEUc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038