UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9HrTFrZjEiCgCqfhPLdDuLjeYJ3b+NBed8tDdrPlCdY='
WHERE
key_id = 'e9331d0e1a9c03d7991afe480813d991cf5606a56be96c87678b4f12cffe6ba1'
AND (
token = '9HrTFrZjEiCgCqfhPLdDuLjeYJ3b+NBed8tDdrPlCdY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)