UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p5oLEqbjMnKCZyM6VTs3GBQG45J/rba8NiMDOos1Xm4='
WHERE
key_id = 'b699fdda00656e98eb3b996e58cd76359c3b0eaf64bf52cce4d344b07a13bf6f'
AND (
token = 'p5oLEqbjMnKCZyM6VTs3GBQG45J/rba8NiMDOos1Xm4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)