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

Query time 0.00027