UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xiKAEQRi5BU3nTZuWdgHAyhnS+uvClZZg1urOihv/Ns='
WHERE
key_id = 'a82023db94169a5a254b1a75cc2aac1fde8fffaf89b6dbf772a6c8500a578215'
AND (
token = 'xiKAEQRi5BU3nTZuWdgHAyhnS+uvClZZg1urOihv/Ns='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)