UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RZDq+/x5S8KzbuYmCEMo7pqm9RZMzabguN/skF6ewro=' 
WHERE 
  key_id = '146916934a8f1e77a24cc1398d2259d730ed4fe2e9b8aaff95113fcb41944272' 
  AND (
    token = 'RZDq+/x5S8KzbuYmCEMo7pqm9RZMzabguN/skF6ewro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019