UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9CLhwCpJRjeYMrBouZvDdgFlfRUKH8/J0uDOfSOprrA='
WHERE
key_id = 'b013d26456e5a11b8b18f99452f088a613eed79d3d4239100cecf3d2642a2954'
AND (
token = '9CLhwCpJRjeYMrBouZvDdgFlfRUKH8/J0uDOfSOprrA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)