UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YJ7DikFK69RYCGBvlRVf2BwajaCW8Bkhtqh1m3PGP9Y=' 
WHERE 
  key_id = '59e8fddb3331eaa947efacec316543c8c694da8ae110f3d3d822c4a3ce231254' 
  AND (
    token = 'YJ7DikFK69RYCGBvlRVf2BwajaCW8Bkhtqh1m3PGP9Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023