UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mIrVuY6n8EW4JW267d0Qpa6YICPY/S5lnwFILvVynOs='
WHERE
key_id = '2e39d1fef0d1332f1d6b4c5eec0277830340c7590bd357caa29da52e162e7c6a'
AND (
token = 'mIrVuY6n8EW4JW267d0Qpa6YICPY/S5lnwFILvVynOs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)