UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y0NPsK6G878cZxZcw4T+rGo1sV9N5iTciJdpS1i0eww='
WHERE
key_id = 'd88f0c7c8983535ca0b6b1db0b7a9bcaea5a0b43e42e008fb03455439f6f0d39'
AND (
token = 'Y0NPsK6G878cZxZcw4T+rGo1sV9N5iTciJdpS1i0eww='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)