UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GynUdr/w4GKqjmvxbnmfOP8iAaVcGQ+h4T1uxa2XgLU=' 
WHERE 
  key_id = '3f4e67c9cb078a6003f63655774f9c37706a288580fdc37369b41bc91fb5fdd0' 
  AND (
    token = 'GynUdr/w4GKqjmvxbnmfOP8iAaVcGQ+h4T1uxa2XgLU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031