UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qXlCAm5jXolAdszztHHJ2QpeSTfJDrM1F949aIgmCqA=' 
WHERE 
  key_id = '3f7036a3224a93217488e6d788430b913ba6df2351e16437bc8063c0ad3fd0d9' 
  AND (
    token = 'qXlCAm5jXolAdszztHHJ2QpeSTfJDrM1F949aIgmCqA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019