UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gBqHnnYTmwNCtMr2O0n3QVZmxHxHohfNURqDXrdTDaE=' 
WHERE 
  key_id = 'f82539d4be98ac42ff88fada20c9524c911801904178f7338fcfc719c0ebd531' 
  AND (
    token = 'gBqHnnYTmwNCtMr2O0n3QVZmxHxHohfNURqDXrdTDaE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038