UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CP77n5OpBTuqUvqif9F52NiNSP7KW3TGVP2vKojzyqA='
WHERE
key_id = '5409abc15fe04b9d151373932cd33c6e6b46cd56c47540ee48847b4a1ca05f30'
AND (
token = 'CP77n5OpBTuqUvqif9F52NiNSP7KW3TGVP2vKojzyqA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)