UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4brPNL12Oh4fVV49HnI7sakw4TwL0DqAe4BdbonHrI0='
WHERE
key_id = 'a3a64334e123ce06a48edbe1348f058b62d6191ff0c1e5258a9535edea70d0ba'
AND (
token = '4brPNL12Oh4fVV49HnI7sakw4TwL0DqAe4BdbonHrI0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)