UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JoGfadGHS2XanR/yfHdnKVEKtfZDmiABC+tXCKCRn2w='
WHERE
key_id = '20d677a57e75fa36d258370fc11afb48395b9c358bdbdf3d0ac66151d4b4435a'
AND (
token = 'JoGfadGHS2XanR/yfHdnKVEKtfZDmiABC+tXCKCRn2w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)