UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nFPRqC01aD+7N1Brkc9bO8ga+vWzhBdL5UktCDgi2B4=' 
WHERE 
  key_id = '4476be16ff65dfdcd17724226ec8a40e6281d559e08864bfbf2039ea7c7e1d85' 
  AND (
    token = 'nFPRqC01aD+7N1Brkc9bO8ga+vWzhBdL5UktCDgi2B4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045