UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TOdjEvyTN/cZ9Ch5zgiznz0PUjH8mLV8u+uOjfs3ids=' 
WHERE 
  key_id = '04c5066c577822e42bef2b7414d6a67b31540f151ffec035a6d28fa47048075c' 
  AND (
    token = 'TOdjEvyTN/cZ9Ch5zgiznz0PUjH8mLV8u+uOjfs3ids=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021