UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RCS+LRAXg2j8ga2ZxfXED32JjWD0LjBjxDZXmBGO0YY=' 
WHERE 
  key_id = '3988771422e39262cbf283d6f43ee5873b348684dba2d87d1da3d2da055ef004' 
  AND (
    token = 'RCS+LRAXg2j8ga2ZxfXED32JjWD0LjBjxDZXmBGO0YY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046