UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cngojSQViVtFHXMwqrlOjmZ7h2I2PYIeBUeZwr5SomA='
WHERE
key_id = 'a030e184987307d4f2facdd0d069743a9f2776e46d219f054e636c8dc9047cfc'
AND (
token = 'cngojSQViVtFHXMwqrlOjmZ7h2I2PYIeBUeZwr5SomA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)