UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WoyOkwYdKhbAz4RPJA+erNRCoIZmWV2zu+WIhVp3dBA=' 
WHERE 
  key_id = '7604eb898112122d59c174531805d2c17d5da6cc5362d11ebd5f2e4d910c872e' 
  AND (
    token = 'WoyOkwYdKhbAz4RPJA+erNRCoIZmWV2zu+WIhVp3dBA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034