UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CUd1x+uKbga1G6FkmmXIIx/SqE8DOUDAAMD9ENeS+Mc='
WHERE
key_id = '42349fccfaa88a8f611545700cc8464411b18d746d403fa1d0caca7cc971d168'
AND (
token = 'CUd1x+uKbga1G6FkmmXIIx/SqE8DOUDAAMD9ENeS+Mc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)