UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'odJHxSzGj+60FvZSvQ4ieJhzomvZ3VciOa5l94gWViA='
WHERE
key_id = '65d4518399835dd0927910963358f42fae3df4b7f449892e2011bd2adfecfd9a'
AND (
token = 'odJHxSzGj+60FvZSvQ4ieJhzomvZ3VciOa5l94gWViA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)