UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v4g1tctRZSXLuc93yVZPO9+HMbM3yO22do0D40JdXmQ='
WHERE
key_id = 'de77429b8fa52b61bd4f1c4662c0c501066e51e36395e711091059aea4065322'
AND (
token = 'v4g1tctRZSXLuc93yVZPO9+HMbM3yO22do0D40JdXmQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)