UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h5NKe8Q6xOAiyq0N/vC8sxbuHb17hFePpsmbTGfcbCU=' 
WHERE 
  key_id = '8009db8936bbc7412dea333f6ac639628efd31281f4b05578c95b44a9471ac9a' 
  AND (
    token = 'h5NKe8Q6xOAiyq0N/vC8sxbuHb17hFePpsmbTGfcbCU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034