UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RC0vNFxV/fvtUiyOF7CSCUh68WSCkGQhcqYQF9FzLn4='
WHERE
key_id = 'ec527c12a1028dbd9952df052a3273d06f9c33cfdc24f4657660669ee53a7f37'
AND (
token = 'RC0vNFxV/fvtUiyOF7CSCUh68WSCkGQhcqYQF9FzLn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)