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

Query time 0.00032