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