UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7T2icUM2E2UL0yx527uADzu3EsU9YGBg98mKVcRep/I=' 
WHERE 
  key_id = 'c7f93f4f823a87d16123d3eaa7cc68c359937677a77304ef4bb1b3ac80f8a581' 
  AND (
    token = '7T2icUM2E2UL0yx527uADzu3EsU9YGBg98mKVcRep/I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025