UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '21Rfcp0Hd0UyBL5bRPW/neHCOb63xxowiOnSSlk/jWg=' 
WHERE 
  key_id = '7c20a14a47146eac28e16c2b3016d755e72e3b3b4b567a4d4a7d178036663913' 
  AND (
    token = '21Rfcp0Hd0UyBL5bRPW/neHCOb63xxowiOnSSlk/jWg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046