UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'muudK5+B0ZYnqekXGAAUXI6dnedTaMNZWuwHeWNdj1s=' 
WHERE 
  key_id = '343792cacb5ee8fe049b9ef38bf6648ca0c1c954bb77302288838afcd15f97a8' 
  AND (
    token = 'muudK5+B0ZYnqekXGAAUXI6dnedTaMNZWuwHeWNdj1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034