UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/agtAGtBwVrMH3zlV55WzD/5PR3QG2AXbtJku9o2UqQ='
WHERE
key_id = 'a580a9a3675296c82a63f86a254c91e11de66d55225976125bc991a02da7b1f1'
AND (
token = '/agtAGtBwVrMH3zlV55WzD/5PR3QG2AXbtJku9o2UqQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)