UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zr7LPyGkxE48r/UWpqfjaV1lijfOn3Xufl8UURtnY9o=' 
WHERE 
  key_id = '0f81161bd08565111e6a0b83d152ea54dfe2181f4a22997810a4f28d8c922d17' 
  AND (
    token = 'Zr7LPyGkxE48r/UWpqfjaV1lijfOn3Xufl8UURtnY9o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026