UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a8R0kA+xSuO9NonU6iN6vZlpuZkykxtCQN655yRirLY=' 
WHERE 
  key_id = 'e84c02902e2139b4c0191b6dbcd196e18e2249a6431c6d609e2ee38ff58d0fdd' 
  AND (
    token = 'a8R0kA+xSuO9NonU6iN6vZlpuZkykxtCQN655yRirLY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051