UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8CXFX9cap7zNqOSCeBHXIWe8MGgNrdN6hOa0tseZWW0='
WHERE
key_id = 'cc1578e330339263f0ee41aa440f608f3c3d43417c3ecbb69872e9a33cb749c5'
AND (
token = '8CXFX9cap7zNqOSCeBHXIWe8MGgNrdN6hOa0tseZWW0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)