UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hNH5aiehMitpo9+TBB/aR6PAeDOhTZndW0fQkoXFG34=' 
WHERE 
  key_id = 'cc921723a42943b735eb6265b40055f67cfbedb60362818b4f99a9d81e9b4cb1' 
  AND (
    token = 'hNH5aiehMitpo9+TBB/aR6PAeDOhTZndW0fQkoXFG34=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045