UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CKA4F3pYcjgdNco48QOMXcZ6eFdByOwvpHsRiMB+wi0='
WHERE
key_id = '9969b45ff60b17cffa57a9a9304a3b8c300cf725bb865da5ef85f8b5d333c5ec'
AND (
token = 'CKA4F3pYcjgdNco48QOMXcZ6eFdByOwvpHsRiMB+wi0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)