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