UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KXbR3Vi8xDy9OF+2jzJRXuMzxc8eXcAhb2BdmmKuM98=' 
WHERE 
  key_id = '5e8f30383cb8e5a3e64ffda3ddb3371adc777484e991e5b83521b376c00fb373' 
  AND (
    token = 'KXbR3Vi8xDy9OF+2jzJRXuMzxc8eXcAhb2BdmmKuM98=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030