UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ceg+Yx6WdnTp901abq+HOmb4SpbBC0g0FbUEXw588oo=' 
WHERE 
  key_id = 'a9abc1f3b209639435dd3be105dbade5bb1d67049cc6171e8797e904be4768ed' 
  AND (
    token = 'ceg+Yx6WdnTp901abq+HOmb4SpbBC0g0FbUEXw588oo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065