UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PAIVcd4AW3mZuaBwKIsCBETHgbReAS6AzKJCyWMtUOA='
WHERE
key_id = 'e4ee4e89ab8d8bd2cd598d9f4822612e2ff6375355073e35b51c3496814ab125'
AND (
token = 'PAIVcd4AW3mZuaBwKIsCBETHgbReAS6AzKJCyWMtUOA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)