UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QciU14PsXiKvAF+V44vAsn9pg6E0HW2vgtX9xxZA6rc='
WHERE
key_id = '8602042edd4ff41a474693ae2823e84de248f19860270dc87e4b455162c8199f'
AND (
token = 'QciU14PsXiKvAF+V44vAsn9pg6E0HW2vgtX9xxZA6rc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)