UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vGh9uBpQ16KOQ24pyRbVpy22fFq6C3G+v7eWC4DWdh8='
WHERE
key_id = 'd1ea43ca28b4639fa9ee1cdd23b4962e7f0bae7a7663eb63604a6acd9a63ed6a'
AND (
token = 'vGh9uBpQ16KOQ24pyRbVpy22fFq6C3G+v7eWC4DWdh8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)