UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aqmoCSPQWltLFEAWe4R5zcnyUB1ft17HkN+WOUCjnHk='
WHERE
key_id = '3eb4294d631c0464f0a74d13e8078860b7f3ac7eed75d04b18d63720b667e527'
AND (
token = 'aqmoCSPQWltLFEAWe4R5zcnyUB1ft17HkN+WOUCjnHk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)