UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KS5/Qsqs5sn0XqZqYz0L3bIv18hBh1rEvI1UsOaG5P8='
WHERE
key_id = '167a98817a677c567098d60006b3340b4a8f6a47593010f91eb5b71b35f29a54'
AND (
token = 'KS5/Qsqs5sn0XqZqYz0L3bIv18hBh1rEvI1UsOaG5P8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)