UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AOJ9y7wtrLNWHgs4Zb+ImL1GuUl3yrR0FbQKtoM7ct8='
WHERE
key_id = 'b503c1c192ba2ad9f80901a68c1e5b49d79b23eafe404690ae2e39c6199a965f'
AND (
token = 'AOJ9y7wtrLNWHgs4Zb+ImL1GuUl3yrR0FbQKtoM7ct8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)