UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VGVB3jQPHsBmPARIlIIjU+cdxaORz1YQ82c2WILSCzQ='
WHERE
key_id = '846ecaa456c7fd9977a08a14f0fa85d819f14b2a2aaf6440c62efef29b972e1b'
AND (
token = 'VGVB3jQPHsBmPARIlIIjU+cdxaORz1YQ82c2WILSCzQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)